/**
 * Created by Administrator on 2017/3/28 0028.
 */
    import React,{Component} from 'react'
import '../App.css'
import formatTime from '../util/formatTime'
export  default class DisplayLog extends Component{
    renderEmpty = () => {
        return <ul className="log">
            <span className="empty-log">空空如也</span>
        </ul>
    }
    
    renderLog = ()=>{
       // var arr1 =  this.props.log.map(function (item ,i) {
       //     return <li>formatTime(item)</li>
       // })
       //  return arr1;

        return this.props.log.map(item =>{
            return <li className="log-item">{formatTime(item)}</li>
        })
    }

  render(){
    if (this.props.log.length === 0){
       return  this.renderEmpty();
    }else {
        var arr = this.renderLog();
        return <ul  className="log">
            {arr}
        </ul>
    }
  }
}

